.PHONY: all clean
LIBXML2_CFLAGS=`xml2-config --cflags`
LIBXML2_LDFLAGS=`xml2-config --libs`
LD_LIBRARY_PATH=.
CC=g++
FUSE_CFLAGS=-D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26
FUSE_LDFLAGS=-lfuse
BIN_OBJECTS=fscontroller.o fuse_compats.o fslayer.o
HEADER_OBJECTS=ptrlist.h.gch fscontroller.h.gch fslayer.h.gch fuse_compats.h.gch 
OBJECTS=$(HEADER_OBJECTS) $(BIN_OBJECTS)
EXECUTABLES=dummy fusezilla.local
LINK_FLAGS=$(LIBXML2_LDFLAGS) $(FUSE_LDFLAGS) $(BIN_OBJECTS)

all: $(OBJECTS) $(EXECUTABLES);

clean:
	rm -f $(OBJECTS) $(EXECUTABLES)

%.o: %.cpp
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(FUSE_CFLAGS) $(LIBXML2_CFLAGS) $< -o $@

%.h.gch: %.h
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $(FUSE_CFLAGS) $(LIBXML2_CFLAGS) $<

fzftp:
	$(CC) $(CFLAGS) $(CPPFLAGS) $(LIBXML2_CFLAGS) $(LIBXML2_LDFLAGS) fzftp.c -o fzftp libfusezilla.so

dummy: dummy.cpp
	$(CC) $(CFLAGS) $(CPPFLAGS) $(FUSE_CFLAGS) $(LIBXML2_CFLAGS) $(LINK_FLAGS) $< -o $@

fusezilla.local: fs_local.cpp
	$(CC) $(CFLAGS) $(CPPFLAGS) $(FUSE_CFLAGS) $(LIBXML2_CFLAGS) $(LINK_FLAGS) $< -o $@

mod_%.so: mod_%.cpp
	$(CC) $(CFLAGS) $(CPPFLAGS) $(FUSE_CFLAGS) $(LIBXML2_CFLAGS) $(LINK_FLAGS) $< -o -shared $@
